<template>
	<view>

		<view class="search">
			<u-search shape="round" :showAction="false" placeholder="搜索设备"></u-search>
		</view>
		<view class="list">
			<view class="li">
				<u-list @scrolltolower="scrolltolower">
					<u-list-item v-for="(item,index) in deviceList" :key="index">
						<u-cell :title="item.deviceName" size="large" :isLink="true" @click="dtn(item.deviceId)"
							rightIconStyle="font-size: 32rpx">
						</u-cell>
					</u-list-item>
				</u-list>
			</view>
		</view>
	</view>
</template>

<script>
	import indexApi from "@/api/index.js"
	export default {
		name: "deviceList",
		data() {
			return {
				deviceList: [],
			}
		},
		onLoad(option) {
			indexApi.listDevice({status:"3",deviceId:option.deviceId}).then(res=>{
				this.deviceList = res.data.rows;
			})
		},
		methods: {
			dtn(e) {
				console.log(e)
				uni.navigateTo({
					url: '/pages/conditionList/conditionList?deviceId='+e
					// url: '/pages/conditionList/conditionList?deviceId='+encodeURIComponent(JSON.stringify(e))
				})
			}
		},
	}
</script>

<style>
	.search {
		padding: 0 32rpx;
		margin-bottom: 18rpx;
	}

	.list {
		padding: 22rpx 0px 0;
		background-color: #EFEFF4;
	}

	.li {
		background: #FFFFFF;
	}
</style>